package com.nf.health.app.inquiry.impl.viewholder;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.nf.health.app.R;
import com.nf.health.app.widget.OnMyOnClistener;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Jason on 2016/9/22.
 */
public class DoctorCommentHeaderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    @Bind(R.id.tv_discuss_num)
    TextView tv_discuss_num;//关注医生数量
    @Bind(R.id.tv_query_comment_all)
    TextView tv_query_comment_all;//查看全部
    @Bind(R.id.ll_discuss_nodata)
    LinearLayout ll_discuss_nodata;
    private OnMyOnClistener onMyOnClistener;


    private Activity cnt;
    public DoctorCommentHeaderViewHolder(View itemView,OnMyOnClistener onMyOnClistener ) {
        super(itemView);
        ButterKnife.bind(this, itemView);
        tv_query_comment_all.setOnClickListener(this);
        this.onMyOnClistener = onMyOnClistener;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case  R.id.tv_query_comment_all://查看全部
                if(onMyOnClistener != null){
                    onMyOnClistener.onMyClickCallBack();
                }
                break;
        }
    }
    /**
     * 刷新布局
     */
    public void   reFreshMyTvText(int commentlistSize){

        tv_discuss_num.setText("用户评价（"+commentlistSize+"）人");
        if(commentlistSize == 0){
            tv_query_comment_all.setVisibility(View.GONE);
            ll_discuss_nodata.setVisibility(View.VISIBLE);
        }else{
            tv_query_comment_all.setVisibility(View.VISIBLE);
            ll_discuss_nodata.setVisibility(View.GONE);
        }
    }
}
